package com.hundsun.documentripper.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.hundsun.documentripper.domain.dto.DocumentTemplateRelationView;
import com.hundsun.documentripper.domain.pojo.DocumentTemplateRelation;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Select;

import java.util.List;

public interface DocumentTemplateRelationMapper extends BaseMapper<DocumentTemplateRelation> {

    @Select("SELECT a.doc_template_code,a.node_template_uuid," +
            "b.name from document_template_relation a,node_template b " +
            "where a.node_template_uuid = b.uuid and a.doc_template_code = #{code}")
    List<DocumentTemplateRelationView> getAllDocumentTemplateRelationByCode(String code);

    Integer insertBatchSomeColumn(List<DocumentTemplateRelation> entityList);

    @Delete("delete from document_template_relation where doc_template_code = #{code}")
    void deleteAllByCode(String code);
}
